home *** CD-ROM | disk | FTP | other *** search
- /*
- File: PanelEditor.h
-
- Contains: Sample part editor class implementation
-
- Written by: Steve Smith
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- */
-
- #ifndef _PANELEDITOR_
- #define _PANELEDITOR_
-
- // -- Compiler/Preprocessor Switches --
-
- #ifndef _COMPILERDEFS_
- #include "CompDefs.h"
- #endif
-
- // -- PanelEditor Includes --
-
- #ifndef _PANELEDITORDEF_
- #include "PanelEditorDef.h"
- #endif
-
- // -- OpenDoc Includes --
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
-
- class ODFacet;
- class ODFocusSet;
- class ODFrame;
- class ODMenuBar;
- class ODShape;
- class ODStorageUnit;
- class ODWindow;
- class CList;
- class CScrollbar;
- class CSelection;
- class CPanel;
- class CScrollingList;
- class CListItem;
- class COrderedList;
- class CPrinter;
-
- struct WindowProperties;
-
- //----------------------------------
- // Class Defs
- //----------------------------------
-
- class PanelEditor {
-
- public:
-
- PanelEditor();
- virtual ~PanelEditor();
-
- // -- Initialization --
-
- void InitPart(Environment* ev, ODStorageUnit* storageUnit,
- ODPart* partWrapper);
- void InitPartFromStorage(Environment* ev, ODStorageUnit* storageUnit,
- ODPart* partWrapper);
-
- // -- Storage --
-
- void Release(Environment* ev);
- void ReleaseAll(Environment* ev);
- ODSize Purge(Environment* ev, ODSize size);
- void Externalize(Environment* ev);
- void ExternalizeKinds(Environment* ev, ODTypeList* kindset);
- void ChangeKind(Environment* ev, ODType kind);
- void CloneInto(Environment* ev, ODDraftKey key,
- ODStorageUnit* destinationSU,
- ODFrame* initiatingFrame);
- void WritePartInfo(Environment* ev, ODInfoType partInfo,
- ODStorageUnitView* storageUnitView);
- ODInfoType ReadPartInfo(Environment* ev, ODFrame* frame,
- ODStorageUnitView* storageUnitView);
- void ClonePartInfo(Environment *ev, ODDraftKey key, ODInfoType partInfo,
- ODStorageUnitView* storageUnitView,
- ODFrame* scopeFrame);
- void SetDirty(Environment* ev);
-
- // -- Layout --
-
- void DisplayFrameAdded(Environment* ev, ODFrame* frame);
- void DisplayFrameRemoved(Environment* ev, ODFrame* frame);
- void DisplayFrameClosed(Environment* ev, ODFrame* frame);
- void DisplayFrameConnected(Environment* ev, ODFrame* frame);
- void AttachSourceFrame(Environment* ev, ODFrame* frame,
- ODFrame* sourceFrame);
- void ViewTypeChanged(Environment* ev, ODFrame* frame);
- void FrameShapeChanged(Environment* ev, ODFrame* frame);
- ODShape* RequestFrameShape(Environment *ev, ODFrame* embeddedFrame,
- ODShape* frameShape);
- ODID Open(Environment* ev, ODFrame* frame);
-
- // -- Imaging --
-
- void Draw(Environment* ev, ODFacet* facet, ODShape* invalidShape);
- void GeometryChanged(Environment* ev, ODFacet* facet,
- ODBoolean clipShapeChanged,
- ODBoolean externalTransformChanged);
- void HighlightChanged(Environment* ev, ODFacet* facet);
- void FacetAdded(Environment* ev, ODFacet* facet);
- void FacetRemoved(Environment* ev, ODFacet* facet);
- ODShape* AdjustBorderShape(Environment *ev, ODFacet* embeddedFacet,
- ODShape* shape);
- CListItem* GetItemNearSelection();
- void UpdateSelection(Environment* ev, CListItem* item);
-
- // -- Activation --
-
- ODBoolean BeginRelinquishFocus(Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame,
- ODFrame* proposedFrame);
- void CommitRelinquishFocus(Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame,
- ODFrame* proposedFrame);
- void AbortRelinquishFocus(Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame,
- ODFrame* proposedFrame);
- void FocusAcquired(Environment* ev,ODTypeToken focus,
- ODFrame* ownerFrame);
- void FocusLost(Environment* ev,ODTypeToken focus,
- ODFrame* ownerFrame);
-
- // -- Event Handling --
-
- ODBoolean HandleEvent(Environment* ev, ODEventData* event,
- ODFrame* frame, ODFacet* facet,
- ODEventInfo* eventInfo);
- void AdjustMenus(Environment* ev, ODFrame* frame);
-
-
- #ifndef PE_ViewerBuild
- // -- Drag and Drop --
-
- ODDragResult DragEnter(Environment *ev, ODDragItemIterator* dragInfo,
- ODFacet* facet, ODPoint* where);
- ODDragResult DragWithin(Environment *ev, ODDragItemIterator* dragInfo,
- ODFacet* facet, ODPoint* where);
- void DragLeave(Environment *ev, ODFacet* facet, ODPoint* where);
- ODDropResult Drop(Environment *ev, ODDragItemIterator* dropInfo,
- ODFacet* facet, ODPoint* where);
- #endif
-
- // -- Undo --
- void UndoAction(Environment* ev, ODActionData* actionState);
- void RedoAction(Environment* ev, ODActionData* actionState);
- void DisposeActionState(Environment* ev, ODActionData* actionState,
- ODDoneState doneState);
-
- // -- Embedding --
-
- void RemoveListItem(Environment* ev, CListItem* item);
-
- // -- Utilities --
-
- ODPart* GetSelf();
- COrderedList* GetEmbeddedItems();
-
-
- //------------------------------------
- protected:
-
- // -- Initialization --
-
- void Initialize(Environment* ev);
-
- // -- Storage --
-
- void CheckAndAddProperties(Environment* ev,
- ODStorageUnit* storageUnit);
- void CleanseContentProperty(Environment* ev,
- ODStorageUnit* storageUnit);
- void InternalizeStateInfo(Environment* ev,
- ODStorageUnit* storageUnit);
- void InternalizeContent(Environment* ev,
- ODStorageUnit* storageUnit);
- void ExternalizeStateInfo(Environment* ev,
- ODStorageUnit* storageUnit,
- ODDraftKey key, ODFrame* scopeFrame);
- void ExternalizeContent(Environment* ev, ODStorageUnit* storageUnit,
- ODDraftKey key, ODFrame* scopeFrame);
- ODBoolean CheckClipboard(Environment* ev, ODFrame* frame);
-
- // -- Event Handling --
-
- ODBoolean HandleMenuEvent(Environment* ev, ODEventData* event,
- ODFrame* frame);
- ODBoolean HandleMouseEvent(Environment* ev, ODEventData* event,
- ODFacet* facet, ODEventInfo* eventInfo);
- void DoDialogBox(Environment* ev, ODFrame* frame,
- ODSShort dialogID, ODUShort errorNumber = 0);
- void DoPartInfo(Environment* ev, ODFrame* frame);
- void DoCut(Environment* ev, ODFrame* frame);
- void DoCopy(Environment* ev, ODFrame* frame);
- void DoPaste(Environment* ev, ODFrame* frame);
- void DoPasteAs(Environment* ev, ODFrame* frame);
- void DoClear(Environment* ev, ODFrame* frame);
- void DoUndo(Environment* ev, ODFrame* frame);
- void DoRedo(Environment* ev, ODFrame* frame);
-
- // -- Imaging --
-
- void DrawFrameView(Environment* ev, ODFacet* facet);
- void DrawIconView(Environment* ev, ODFacet* facet);
- void DrawThumbnailView(Environment* ev, ODFacet* facet);
- PicHandle GenerateThumbnail( Environment* ev, ODFrame* frame);
-
- // -- Activation --
-
- void PartActivated(Environment* ev, ODFrame* frame);
- ODBoolean ActivateFrame(Environment* ev, ODFrame* frame);
- void WindowActivating(Environment* ev, ODFrame* frame, ODBoolean activate);
- void ProcessActivating(Environment* ev, ODFrame* frame, ODBoolean resume);
- void RelinquishAllFoci(Environment* ev, ODFrame* frame);
-
- // -- Layout --
-
- ODWindow* AcquireFramesWindow(Environment* ev, ODFrame* frame);
- ODWindow* CreateWindow(Environment* ev, ODFrame* frame, ODType frameType,
- WindowProperties* windowProperties);
- void CleanupWindow(Environment* ev, ODFrame* frame);
- WindowProperties* GetDefaultWindowProperties(Environment* ev, ODFrame* frame,
- Rect* windowRect);
- WindowProperties* GetSavedWindowProperties(Environment* ev, ODFrame* frame);
- Rect CalcPartWindowSize(Environment* ev, ODFrame* sourceFrame);
- Rect CalcPartWindowPosition(Environment* ev, ODFrame* frame,
- Rect* partWindowBounds);
- ODFacet* GetActiveFacetForFrame(Environment* ev, ODFrame* frame);
- ODShape* CalcNewUsedShape(Environment* ev, ODFrame* frame);
- void UpdateFrame(Environment* ev, ODFrame* frame, ODTypeToken view,
- ODShape* usedShape);
- void CleanupDisplayFrame(Environment* ev, ODFrame* frame,
- ODBoolean frameRemoved);
- void CleanupEmbeddedFrames(Environment* ev, ODFrame* containingFrame,
- ODBoolean frameRemoved);
- void ZoomPartWindow(Environment* ev, ODFrame* frame, ODWindow* window,
- ODBoolean openingWindow);
-
- // -- Embedding --
-
- void EmbedNewItem(Environment* ev, ODFacet* facet, ODID partID);
-
- // --- Getters ---
-
- ODUShort GetMinHeight();
- ODUShort GetMinWidth();
-
- //========================
- private:
-
- ODPart* fSelf;
- CList* fDisplayFrames;
- CPrinter* fPrinter;
-
- COrderedList* fEmbeddedParts;
- CSelection* fSelection;
- CPanel* fPanel;
- CScrollingList* fList;
-
- ODBoolean fReadOnlyStorage;
- ODBoolean fDirty;
- ODBoolean fNegotiating;
- };
-
-
- //-----------------------------------------------------------------------------
- // Inlines
- //-----------------------------------------------------------------------------
-
- inline ODUShort PanelEditor::GetMinHeight()
- { return (2*kListItemHeight+2*kListTopEdge); }
-
-
- inline ODUShort PanelEditor::GetMinWidth()
- { return (kPanelLeftEdge+kMinPanelWidth); }
-
- #endif